// DlgTrack.cpp : implementation file
//

#include "stdafx.h"
#include "MagicWand.h"
#include "DlgTrack.h"
#include "afxdialogex.h"


// CDlgTrack dialog

IMPLEMENT_DYNAMIC(CDlgTrack, CXtremeDialog)

CDlgTrack::CDlgTrack(CWnd* pParent /*=NULL*/)
	: CXtremeDialog(CDlgTrack::IDD, pParent)
{
	m_SliderLoNum = 0;
	m_SliderUpNum = 0;
}

CDlgTrack::~CDlgTrack()
{
}

void CDlgTrack::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_SLIDER_LO, m_sliderlo);
	DDX_Control(pDX, IDC_SLIDER_UP, m_sliderup);
	DDX_Text(pDX, IDC_STC_LO, m_SliderLoNum);
	DDX_Text(pDX, IDC_STC_UP, m_SliderUpNum);
}


BEGIN_MESSAGE_MAP(CDlgTrack, CDialog)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_LO, &CDlgTrack::OnCustomdrawSliderLo)
	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_UP, &CDlgTrack::OnCustomdrawSliderUp)
END_MESSAGE_MAP()


// CDlgTrack message handlers


BOOL CDlgTrack::OnInitDialog()
{
	CXtremeDialog::OnInitDialog();

	m_sliderlo.SetRange(0,255);
	m_sliderup.SetRange(0,255);
	m_sliderlo.SetTicFreq(16);
	m_sliderup.SetTicFreq(16);
	m_sliderlo.SetPos(m_SliderLoNum);
	m_sliderup.SetPos(m_SliderUpNum);
	// TODO:  Add extra initialization here
	//SetResize(IDC_SLIDER_LO,XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT );	

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


void CDlgTrack::OnCustomdrawSliderLo(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_SliderLoNum=m_sliderlo.GetPos();
	UpdateData(FALSE); 
	*pResult = 0;
}


void CDlgTrack::OnCustomdrawSliderUp(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	m_SliderUpNum=m_sliderup.GetPos();
	UpdateData(FALSE); 
	*pResult = 0;
}
